package com.itextpdf.text.pdf;

import java.io.ByteArrayInputStream;
import java.io.File;
import java.util.Map;

/**
 * Created by zc on 2017/3/16.
 */
public class Template {

    public static final String ENCODING_UTF8 = "UTF-8";
    public static final String PDF_FORMAT = ".pdf";
    private String templateName;
    private Map<String, Object> model;
    private String generatePath;
    private String generateName;
    private Template.GENERATE_TYPE generateType;
    private String companyLogo;
    private String companyName;
    private String companyUrl;
    private ByteArrayInputStream inputStrem;

    public Template() {
    }

    public String getGenerateName() {
        return this.generateName != null?this.generateName:(this.generatePath != null && this.generatePath.lastIndexOf(File.separator) == -1?this.generateName:this.generatePath.substring(this.generatePath.lastIndexOf(File.separator) + 1, this.generatePath.length()));
    }

    public String getTemplateName() {
        return this.templateName;
    }

    public void setTemplateName(String templateName) {
        this.templateName = templateName;
    }

    public Map<String, Object> getModel() {
        return this.model;
    }

    public void setModel(Map<String, Object> model) {
        this.model = model;
    }

    public String getGeneratePath() {
        return this.generatePath;
    }

    public void setGeneratePath(String generatePath) {
        this.generatePath = generatePath;
    }

    public void setGenerateName(String generateName) {
        this.generateName = generateName;
    }

    public String getCompanyLogo() {
        return this.companyLogo;
    }

    public void setCompanyLogo(String companyLogo) {
        this.companyLogo = companyLogo;
    }

    public String getCompanyName() {
        return this.companyName;
    }

    public void setCompanyName(String companyName) {
        this.companyName = companyName;
    }

    public String getCompanyUrl() {
        return this.companyUrl;
    }

    public void setCompanyUrl(String companyUrl) {
        this.companyUrl = companyUrl;
    }

    public Template.GENERATE_TYPE getGenerateType() {
        return this.generateType;
    }

    public void setGenerateType(Template.GENERATE_TYPE generateType) {
        this.generateType = generateType;
    }

    public ByteArrayInputStream getByteArrayInputStream() {
        return this.inputStrem;
    }

    public void setByteArrayInputStream(ByteArrayInputStream inputStrem) {
        this.inputStrem = inputStrem;
    }

    public static enum GENERATE_TYPE {
        IO,
        FILE;

        private GENERATE_TYPE() {
        }
    }

}
